package com.jiang.daily.Q1437;

/**
 * @author Jiang
 * @version 1.0
 * @date 2025/11/17 13:50
 */
class Solution {
    public boolean kLengthApart(int[] nums, int k) {
        int len = nums.length;
        int pre = -len - 1;
        for (int i = 0; i < len; i++) {
            if (nums[i] == 1) {
                if (i - pre - 1 < k) {
                    return false;
                }
                pre = i;
            }
        }
        return true;
    }
}
